package com.niiwoo.civet.trade.service.local.loan;

import com.alibaba.dubbo.config.annotation.Reference;
import com.niiwoo.civet.account.dto.response.AccountBaseResponse;
import com.niiwoo.civet.account.service.AccountDubboService;
import com.niiwoo.civet.trade.enums.ProjectTypeEnum;
import com.niiwoo.civet.user.dto.UserPersonalDubboInfoDTO;
import com.niiwoo.civet.user.dto.UserProfessionDubboInfoDTO;
import com.niiwoo.civet.user.dto.response.*;
import com.niiwoo.civet.user.enums.UserForbidTypeEnum;
import com.niiwoo.civet.user.service.*;
import com.niiwoo.tripod.lanmao.enums.UserRoleEnum;
import org.springframework.stereotype.Service;

/**
 * @Author: wuke
 * @Description:
 * @Date: Created in 20:57 2018/4/16
 */
@Service
public class LoanQueryService {
    @Reference(version = "1.0.0")
    private UserForbidDubboService userForbidDubboService;
    @Reference(version = "1.0.0")
    private UserDataDubboService userDataDubboService;
    @Reference(version = "1.0.0")
    private UserIdentityDubboService userIdentityDubboService;
    @Reference(version = "1.0.0")
    private UserBasicInfoDubboService userBasicInfoDubboService;
    @Reference(version = "1.0.0")
    private UserAuthorizationInfoDubboService userAuthorizationInfoDubboService;
    @Reference(version = "1.0.0")
    private AccountDubboService accountDubboService;

    public UserBlackListInfoDTO getUserBlackListInfo(String userId){
        return userForbidDubboService.getUserBlackListInfo(userId);
    }

    public ValidUserForbidResponseDTO queryValidUserForbidInfo(String userId, UserForbidTypeEnum userForbidTypeEnum){
        return userForbidDubboService.queryValidUserForbidInfo(userId,userForbidTypeEnum);
    }

    public UserLibraLoanLimitDTO getUserLibraLoanLimit(String userId, ProjectTypeEnum projectTypeEnum){
        return userForbidDubboService.getUserLibraLoanLimit(userId,projectTypeEnum.getValue());
    }

    public UserIdentityInfoResponseDTO getUserIdentityInfo(String userId){
        return userIdentityDubboService.get(userId);
    }

    public String getUserIdCard(String userId){
        UserIdentityInfoResponseDTO userIdentityInfoResponseDTO = userIdentityDubboService.get(userId);
        return userIdentityInfoResponseDTO==null?null:userIdentityInfoResponseDTO.getIdCard();
    }

    public UserBasicInfoResponseDTO getUserBasicInfo(String userId){
        return userBasicInfoDubboService.getUserBasicInfo(userId);
    }

    public UserAuthorizationInfoResponseDTO getUserAuthorizationInfo(String userId){
        return userAuthorizationInfoDubboService.getUserAuthorizationInfo(userId);
    }

    public UserPersonalDubboInfoDTO getUserPersonalInfo(String userId){
        return userDataDubboService.userPersonalInfo(userId);
    }

    public UserProfessionDubboInfoDTO getUserProfessionInfo(String userId){
        return userDataDubboService.userProfessionInfo(userId);
    }

    public String selectAreaCodeByAreaName(String areaName){
        return userDataDubboService.selectAreaCodeByAreaName(areaName);
    }

    public AccountBaseResponse getAccountBase(String userId, UserRoleEnum role){
        return accountDubboService.getNiiwooAccount(userId,role);
    }

}
